import api from './auth.js'

// 创建新政策
export const createPolicy = (data) => {
  return api.post('/api/api/v1/admin/policy/create', data)
}

// 获取政策列表
export const getPolicyList = (params = {}) => {
  return api.get('/api/api/v1/admin/policy/list', { params })
}

// 获取政策详情
export const getPolicyDetail = (policyId) => {
  return api.get(`/api/api/v1/admin/policy/detail/${policyId}`)
}

// 修改政策
export const updatePolicy = (policyId, data) => {
  return api.put(`/api/api/v1/admin/policy/update/${policyId}`, data)
}

// 发布政策
export const publishPolicy = (policyId) => {
  return api.post(`/api/api/v1/admin/policy/publish/${policyId}`)
}

// 停用政策
export const deactivatePolicy = (policyId) => {
  return api.post(`/api/api/v1/admin/policy/deactivate/${policyId}`)
}

// 删除政策
export const deletePolicy = (policyId) => {
  return api.delete(`/api/api/v1/admin/policy/delete/${policyId}`)
}

// 获取统计信息
export const getPolicyStatistics = () => {
  return api.get('/api/api/v1/admin/policy/statistics')
}

// 获取当前活跃的用户协议
export const getActiveUserAgreement = () => {
  return api.get('/api/api/v1/admin/policy/active/user_agreement')
}

// 获取当前活跃的隐私政策
export const getActivePrivacyPolicy = () => {
  return api.get('/api/api/v1/admin/policy/active/privacy_policy')
} 